Create a live stream
This guide will walk you through the process of setting up and managing a live streaming event using the Teyuto API. Live streaming allows you to broadcast real-time video content to your audience.
1. Creating a Live Stream
To create a new live stream:
- Use the
POST /videos/live
endpoint - Set up your request headers:
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Authorization: YOUR_API_KEY - In the request body, include the following parameters:
title
: The title of your live streamdescription
: A description of the streamprivacy
: Set to "public", "hidden", or "registered"collection_id
: ID of the collection to attach the stream to (if applicable)tag_ids[]
: Array of tag IDs to associate with the streamstartdate
: The scheduled start date and time of the stream (format: "YYYY-MM-DD HH:MM:SS")
Example cURL request:
curl -X POST "https://api.teyuto.tv/v2/videos/live" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-H "Authorization: YOUR_API_KEY" \
-d "title=My Live Stream&description=An exciting live event&privacy=public&collection_id=12345&tag_ids[]=678&tag_ids[]=901&startdate=2023-06-15 14:00:00"
The API will respond with a JSON object containing the details of the created live stream, including its ID.
2. Retrieving Stream Details
To get the details of your live stream:
- Use the
GET /videos/{id}
endpoint - Replace
{id}
with the ID of your live stream
Example cURL request:
curl -X GET "https://api.teyuto.tv/v2/videos/67890" \
-H "Accept: application/json" \
-H "Authorization: YOUR_API_KEY"
This will return detailed information about your live stream, including the stream_key
and server_live
which you'll need for configuring your streaming software.
3. Configuring Your Streaming Software
Use the server_live
as your streaming URL and the stream_key
as your stream key in your preferred streaming software (e.g., OBS, Streamlabs).
4. Updating Live Stream Information
To update your live stream's information:
- Use the
PATCH /videos/{id}
endpoint - Replace
{id}
with your live stream's ID - Include the fields you want to update in the request body
Example cURL request:
curl -X PATCH "https://api.teyuto.tv/v2/videos/67890" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-H "Authorization: YOUR_API_KEY" \
-d "title=Updated Live Stream Title&description=New description for my live event"
5. Starting and Ending the Live Stream
The actual start and end of the stream are typically controlled through your streaming software. When you start streaming, Teyuto will automatically detect the incoming stream and make it live.
6. Monitoring Your Live Stream
While the OpenAPI specification doesn't provide specific endpoints for monitoring, you may be able to periodically check the stream's status using the GET /videos/{id}
endpoint.
7. Ending the Live Stream
To end your live stream, simply stop broadcasting from your streaming software. Teyuto should automatically detect that the stream has ended.
Best Practices
- Test Before Going Live: Always do a test stream to ensure everything is set up correctly.
- Backup Plans: Have a backup internet connection and streaming device if possible.
- Moderation: If your platform allows, assign moderators to help manage chat and viewer interactions.
- Promote in Advance: Use the
startdate
parameter to schedule your stream and promote it beforehand. - Update Stream Info: Keep your stream title and description updated to reflect any changes in your content.
- Monitor Performance: Regularly check your stream's performance and viewer count if these metrics are available.
Considerations
- Ensure you have sufficient bandwidth for the quality of stream you're planning to broadcast.
- Be aware of any time limits or viewer limits that may apply to your account.
- Familiarize yourself with Teyuto's content policies to ensure your stream complies with their guidelines.
Remember, the exact features and capabilities may vary based on your Teyuto account type and the specific implementation of the API. Always refer to the most up-to-date Teyuto documentation and don't hesitate to contact their support for specific questions or issues.